﻿{% extends "base.html" %}

{% block title %}Редактирование профиля{% endblock %}

{% block includes %}
<link href="/static/css/accordion.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/static/js/mootools.js"></script>
<!--<script type="text/javascript" src="/static/js/accordion/main.js"></script>-->
{{ contactsForm.media }}
{{ placeFormSet.media }}
{% endblock %}

{% block header %}Редактирование профиля{% endblock %}

{% block content %}
<div id="accordion">
<form method="post" action="{{ 'userprofile.views.edit_profile'|url }}">
	
	<h3 class="toggler">Информация о себе</h3>
	<div class="element">
		<table>
		{% for field in mainForm %}
			<tr>
				<th>
				<label for="{{ field.name }}">
					{{ field.label_tag() }}
				</label>
				</th>
				<td>
				{{ field }}
				{% if field.errors %}
					<div class="errors">{{ field.errors }}</div>
				{% endif %}
				</td>
			</tr>
		{% endfor %}
		</table>
	</div>
	
	<h3 class="toggler">Контактная информация</h3>
	<div class="element">
		<table>
		{% for field in contactsForm.visible_fields() %}
				<tr>
					<th>
					<label for="{{ field.name }}">
						{{ field.label_tag() }}
					</label>
					</th>
					<td>
					{{ field }}
					{% if field.errors|length != 0 %}
						<div class="errors">{{ field.errors }}</div>
					{% endif %}
					</td>
				</tr>
		{% endfor %}
        {% for hidden in contactsForm.hidden_fields() %}
        	{{ hidden }}
        {% endfor %}
        </table>
	</div>
	<h3 class="toggler">Места</h3>
	<div class="element">    
		{{ placeFormSet.management_form }}
		{% for placeForm in placeFormSet.forms %}
		<table class="place">
			{% for field in placeForm.visible_fields() %}
				<tr>
					<th>
						<label for="{{ field.name }}">
							{{ field.label_tag() }}
						</label>
					</th>
					<td>
						{{ field }}
						{% if field.errors|length != 0 %}
							<div class="errors">{{ field.errors }}</div>
						{% endif %}
					</td>
				</tr>
			{% endfor %}
			{% for field in placeForm.hidden_fields() %}
				{{ field }}
				{% if field.errors %}
					<div class="errors">{{ field.errors }}</div>
				{% endif %}
			{% endfor %}
		</table>
		{% endfor %}
		<p style="display: block; height: 20px; width:20px; padding:2px; font-family: Verdana; font-size: 16px; cursor: pointer;" id="add_place_form">+</p>
	</div>
	<input type="submit" value="Сохранить изменения" />
	<input type="hidden" name="next" value="{{ next }}" />
</form>
<ul id="suggest"></ul>
</div>

{% endblock %}
